package com.boot.security.server.dao.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.product.TswProductClassify;

@Mapper
public interface TswProductClassifyDao {

    @Select("select * from tsw_product_classify t where t.id = #{id}")
    TswProductClassify getById(Long id);

    @Delete("delete from tsw_product_classify where id = #{id}")
    int delete(Long id);

    int update(TswProductClassify tswProductClassify);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_product_classify(classify_parent_id, classify_no, classify_name, state, create_time, classify_image_path, classify_sorting, creater, update_time, updater, classify_note, classify_remark) values(#{classifyParentId}, #{classifyNo}, #{classifyName}, #{state}, #{createTime}, #{classifyImagePath}, #{classifySorting}, #{creater}, #{updateTime}, #{updater}, #{classifyNote}, #{classifyRemark})")
    int save(TswProductClassify tswProductClassify);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswProductClassify> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
